package com.MyDemo.demo.handler;

import com.MyDemo.demo.enums.OrderEventsEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;
import org.springframework.stereotype.Component;

@Component("orderStateListener")
@WithStateMachine(name = "orderStateMachine")
public class OrderStateListener {
    Logger logger = LoggerFactory.getLogger(OrderStateListener.class);
    @OnTransition(source = "CREATE", target = "PROCESS")
    public boolean pay(Message<OrderEventsEnum> message){
        logger.warn("订单流转: create -> process");
        logger.warn("==============================");
        return true;
    }
}
